﻿using FluentNHibernate.Mapping;
using Sebrae.Academico.Trilhas.Dominio.Classes;

namespace Sebrae.Academico.Trilhas.BM.Mapeamentos
{

    public sealed class TrilhaMap : ClassMap<Trilha>
    {
        /// <summary>
        /// Construtor.
        /// </summary>
        public TrilhaMap()
        {
            Table("TB_TRILHA");
            LazyLoad();
            Id(x => x.ID).GeneratedBy.Identity().Column("ID_TRILHA");
            Map(x => x.Nome).Column("NM_TRILHA");
            //Map(x => x.DataAlteracao).Column("DATAATUALIZACAO").Not.Nullable();
            //References(x => x.Usuario).Column("ID_USUARIOATUALIZACAO").Not.Nullable().Cascade.None();
            
            HasMany(x => x.ListaItemTrilha).KeyColumn("ID_TRILHA").AsBag();
            HasMany(x => x.ListaUsuarioTrilha).KeyColumn("ID_TRILHA").AsBag();
        }

    }
}
